#include <cmath>
#include <iostream>


/**
 * 
 * 四平方和
 */
using namespace std;
int main() {
    int n;
    cin >> n;
    for (int i = 0; i * i <= n; i++) {
        for (int j = i; i * i + j * j <= n; j++) {
            for (int k = j; i * i + j * j + k * k <= n; k++) {
                int tmp = n - (i * i + j * j + k * k);
                int x = sqrt(tmp);
                if (x * x == tmp) {
                    cout << i << " " << j << " " << k << " " << x << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}